package com.dayatang.android.Activity;

import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

public class FootCommonActivity extends BaseActivity {

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.foot);
	}

	/**
	 * 设置主内容区域的layoutRes
	 * 
	 * @param layoutResId
	 */
	public void AlabSetContentView(int layoutResId) {
		LinearLayout llContent = (LinearLayout) findViewById(R.id.foot_template_center);
		LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(layoutResId, null);
		llContent.addView(v);
	}

	public void AlabSetBarTitleText(String titleText) {
		TextView tv = (TextView) findViewById(R.id.foot_template_head_title);
		if (null != tv) {
			tv.setText(titleText);
		}
	}
	
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
			this.finish();
			finishActivityTransition();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

}
